package com.wangnian.task;

import com.wangnian.task.service.JobService;
import com.wangnian.task.util.RedisUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.retry.annotation.EnableRetry;
import org.springframework.scheduling.annotation.EnableAsync;

@EnableAsync
@EnableRetry
@SpringBootApplication
public class TaskApplication implements CommandLineRunner {
    @Autowired
    private JobService jobService;
    @Autowired
    private RedisUtil redisUtil;

    static final Logger logger = LoggerFactory.getLogger(TaskApplication.class);

    public static void main(String[] args) {
        SpringApplication.run(TaskApplication.class, args);
    }

    @Override
    public void run(String... strings) throws Exception {
        //List<JSONObject> maps = redisUtil.getAll();
        //logger.info("启动时读取redis里未执行完的任务，条数:{}", maps.size());
//        for (Map.Entry<String, String> entry : maps.entrySet()) {
//           // jobService.addTask(entry.getKey(),entry.getValue());
//        }
    }
}
